package com.google.android.gms.internal;

import java.security.GeneralSecurityException;
import java.security.NoSuchAlgorithmException;

final class zzduf {
    public static zzdxu zza(zzdvw zzdvw) throws GeneralSecurityException {
        switch (zzdug.zzmfl[zzdvw.ordinal()]) {
            case 1:
                return zzdxu.NIST_P256;
            case 2:
                return zzdxu.NIST_P384;
            case 3:
                return zzdxu.NIST_P521;
            default:
                String valueOf = String.valueOf(zzdvw);
                StringBuilder sb = new StringBuilder(20 + String.valueOf(valueOf).length());
                sb.append("unknown curve type: ");
                sb.append(valueOf);
                throw new GeneralSecurityException(sb.toString());
        }
    }

    public static zzdxv zza(zzdvi zzdvi) throws GeneralSecurityException {
        switch (zzdug.zzmfm[zzdvi.ordinal()]) {
            case 1:
                return zzdxv.UNCOMPRESSED;
            case 2:
                return zzdxv.COMPRESSED;
            default:
                String valueOf = String.valueOf(zzdvi);
                StringBuilder sb = new StringBuilder(22 + String.valueOf(valueOf).length());
                sb.append("unknown point format: ");
                sb.append(valueOf);
                throw new GeneralSecurityException(sb.toString());
        }
    }

    public static String zza(zzdvy zzdvy) throws NoSuchAlgorithmException {
        switch (zzdug.zzmfk[zzdvy.ordinal()]) {
            case 1:
                return "HmacSha1";
            case 2:
                return "HmacSha256";
            case 3:
                return "HmacSha512";
            default:
                String valueOf = String.valueOf(zzdvy);
                StringBuilder sb = new StringBuilder(27 + String.valueOf(valueOf).length());
                sb.append("hash unsupported for HMAC: ");
                sb.append(valueOf);
                throw new NoSuchAlgorithmException(sb.toString());
        }
    }

    public static void zza(zzdvo zzdvo) throws GeneralSecurityException {
        zzdxs.zza(zza(zzdvo.zzbps().zzbqf()));
        zza(zzdvo.zzbps().zzbqg());
        if (zzdvo.zzbpu() == zzdvi.UNKNOWN_FORMAT) {
            throw new GeneralSecurityException("unknown EC point format");
        }
        zzdtn.zza(zzdvo.zzbpt().zzbpn());
    }
}
